package com.smag.web.controller.farming.mall;

import com.smag.common.annotation.Anonymous;
import com.smag.common.core.controller.BaseController;
import com.smag.common.core.page.TableDataInfo;
import com.smag.system.service.FarmProductService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/farming/mall/product")
public class ProductController extends BaseController {
    @Resource
    private FarmProductService farmProductService;

    @Anonymous
    @GetMapping("/listRecProducts")
//    @Log(title = "农资商城")
    public TableDataInfo listRecProducts() {
        startPage();
        return getDataTable(farmProductService.selectRecFarmProduct());
    }

    @Anonymous
    @GetMapping("listProducts")
    public TableDataInfo listProducts(Integer pageNum,Integer pageSize,String productName,Long minPrice, Long maxPrice,Boolean sort,Long categoryId) {
        return farmProductService.listProducts(pageNum,pageSize,productName, minPrice, maxPrice, sort,categoryId);
    }

}
